﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Rectangles
{
    public class Rectangle:IComparable<Rectangle>,ICloneable
    {
        int positionX;
        int positionY;
        int width;
        int hight;

        public int PositionX
        {
            get
            {
                return positionX;
            }
            set
            {
                positionX = value;
            }
        }

        public int PositionY
        {
            get
            {
                return positionY;
            }
            set
            {
                positionY = value;
            }
        }

        public int Width
        {
            get
            {
                return width;
            }
            set
            {
                width = value;
            }
        }

        public int Hight
        {
            get
            {
                return hight;
            }
            set
            {
                hight = value;
            }
        }

        public Rectangle(int positionX, int positionY, int width, int hight)
        {
            this.PositionX = positionX;
            this.PositionY = positionY;
            this.Width = width;
            this.Hight = hight;
        }

        public int CalculateArea() 
        {
            int result = this.Width * this.Hight;
            return result;
        }

        public int CompareTo(Rectangle other)
        {
            int result = this.CalculateArea().CompareTo(other.CalculateArea());
            return result;
        }

        public object Clone()
        {
            Rectangle newReactangle = new Rectangle(this.positionX, this.positionY, this.width, this.hight);
            return newReactangle;
        }
    }
}
